package ar.com.gep.soccer.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import ar.com.cdt.framework.core.pager.Page;
import ar.com.cdt.framework.core.pager.ResultSet;
import ar.com.gep.soccer.exception.TeamBusinessException;
import ar.com.gep.soccer.facade.TeamFacade;
import ar.com.gep.soccer.services.TeamService;
import ar.com.gep.soccer.services.dto.TeamDTO;

@Service
public class TeamServiceImpl implements TeamService {

	@Autowired
	TeamFacade teamFacade;

	@Override
	public List<TeamDTO> getAll() throws TeamBusinessException {
		return teamFacade.getAllTeams();
	}

	@Override
	public TeamDTO getById(final Long id) throws TeamBusinessException {
		return teamFacade.getTeamById(id);
	}

	@Override
	public void save(final TeamDTO teamDTO) throws TeamBusinessException {
		teamFacade.saveTeam(teamDTO);
	}

	@Override
	public void update(final TeamDTO teamDTO) throws TeamBusinessException {
		teamFacade.updateTeam(teamDTO);
	}

	@Override
	public ResultSet<TeamDTO> getAll(final Page page) throws TeamBusinessException {
		return teamFacade.getAllTeams(page);
	}

}
